package com.gzz.orchid.context.application.rbac;

import com.gzz.orchid.common.core.model.ActionCmd;
import com.gzz.orchid.context.application.rbac.command.ChangePasswordCmd;
import com.gzz.orchid.context.application.rbac.command.UserGrantCmd;
import com.gzz.orchid.context.application.rbac.command.UserSaveCmd;
import com.gzz.orchid.context.domain.rbac.entity.UserId;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;

/**
 * @author higmd
 */
@Validated
public interface IUserExecutor {
    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
    void save(UserSaveCmd saveCmd);

    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
    void delete(ActionCmd cmd);

    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
    void disable(ActionCmd cmd);

    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
    void enable(ActionCmd cmd);

    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
    void audit(ActionCmd cmd);

    void changePassword(ChangePasswordCmd cmd);

    void resetPassword(UserId code);

    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
    void grantPrivilege(UserGrantCmd cmd);
}
